package org.ww.order.service;

import com.baomidou.mybatisplus.extension.service.IService;
import org.ww.common.to.mq.SeckillOrderTo;
import org.ww.common.utils.PageUtils;
import org.ww.order.entity.OrderEntity;
import org.ww.order.vo.*;

import java.util.Map;
import java.util.concurrent.ExecutionException;

/**
 * 订单
 *
 * @author ww
 * @email ww@qq.com
 * @date 2024-01-05 15:02:52
 */
public interface OrderService extends IService<OrderEntity> {

    PageUtils queryPage(Map<String, Object> params);

    /**
     * 订单确认接口
     * @return
     */
    OrderConfirmVo confirmOrder() throws ExecutionException, InterruptedException;

    /**
     * 进行下单操作
     * @param vo
     * @return
     */
    SubmitOrderResponseVo submitOrder(OrderSubmitVo vo);

    /**
     * 根据订单号查询
     * @param orderSn
     * @return
     */
    OrderEntity getByOrderSn(String orderSn);

    /**
     * 订单过期，执行关单逻辑
     * @param entity
     */
    void orderClose(OrderEntity entity);

    /**
     * 根据订单号获取支付信息
     * @param orderSn
     * @return
     */
    PayVo getPayVo(String orderSn);

    /**
     * 查询当前登录用户的订单列表
     * @param params
     * @return
     */
    PageUtils listWithItem(Map<String, Object> params);

    /**
     * 处理支付宝支付结果
     * @param asyncVo
     * @return
     */
    String handlePayResult(PayAsyncVo asyncVo);

    void createSeckillOrder(SeckillOrderTo orderTo);

}

